import { Toast,Dialog } from "vant";
import payKeyboard from "components/payKeyboard";
import { payKeyboardAsync } from "utils/payKeyboard";
let initWithdrawal = "";
import diyBackGround from "./componet/diyBackGround";
import eplusWithdraw from "../../others/wisdom/components/withdraw.vue";
import jianzhimaoPopup from "./componet/jianzhimaoPopup.vue"
import hemaPoup from "../../hema_pay/components/hema_extra_popup.vue";

export default {
  data() {
    return {
      buttons: [],

      ytx_money:0,
      supplier: "",
      balance: 0,
      service_money: 0,
      withdrawType: {}, // 提现方法
      info_form: {
        balance_money: ""
      },
      withdraw_multiple: 1, //余额提现倍数

      // 选择提现方法
      pay_type: "",

      popupVisible: false,

      action: "",

      msg: "",

      notice: "",
      service_type: 0,
      isLocks: false,//防止重复点击

      // 余额字样
      balanceLang: this.fun.getBalanceLang(),
      show2: false, // 判断
      show3: false, // 银行卡列表
      withList: [], // 银行卡列表
      checkObj: {}, // 选中的银行卡
      actual_amount: "", // 实际到账金额
      poundageHj: "", // 手续费
      cost_money: "", // 提现金额
      poundage_name: "", //手续费字样

      payKeyboardShow: false, //键盘显示
      need_password: false, //是否需要验证支付密码
      has_password: false, //是否设置了支付密码
      info: {},

      show:false,
      list:[],
      // 提现到银典支付
      bank_card_status:false,
      // 提现到银典支付 end
      // 帮扶中心 start
      support_code:false,
      support_code_url:'',
      // 帮扶中心 end
      priceDifferencePool:false,
      priceDifferencePool_buttons:[],
      // 兼职猫
      jianzhimao_bank_show:false,
      set_verify:[],
      // YCC资产提现收入比例
      withdraw_income_percent:'',
      // 云汇算代发薪
      popupType:'',
      hema_pic:''
    };
  },
  activated() {
    if(this.$route.name == 'balance_withdrawalspdp'){
      //price-difference-pool 插件的充值页 复用样式
      this.priceDifferencePool = true;
    }
    this.supplier = this.$route.params.supplier;
    this.initData();
    // 获取数据
    if (this.supplier === "supplier") {
      this.getData2();
    } else {
      this.getData();
    }
    initWithdrawal = this.fun.initWithdrawal();

    this.fun.setWXTitle(initWithdrawal);

  },
  computed:{
    countDeduct(){
      let ratio = this.info.deduct_data.point / this.info.deduct_data.balance ;
      return Number(this.info_form.balance_money * ratio).toFixed(2)
    },
  },
  methods: {
    // },
    initData() {
      this.popupVisible = false;
      this.action = "";
      this.msg = "";
      this.notice = "";
      this.pay_type = "";
      this.info_form.balance_money = "";
      this.withdraw_multiple = 1;
      this.show2 = false;
      this.show3 = false;
      //自定义手续费字段
      this.poundage_name = this.fun.initMailLanguage().income.poundage_name;

      this.payKeyboardShow = false;
      this.need_password = false;
      this.has_password = false;
      this.bank_card_status = false;
      this.popupType = '';
    },
    closePopupJZM(){
      this.jianzhimao_bank_show = false;
      this.getData();
    },
    btnclass_difference(type) {
      if (type == 3) {
        return "icon-pay_yue";
      } else if (type == 1) {
        return "icon-pay_wechat";
      } else if (type == 2) {
        return "icon-pay_alipay";
      }
    },
    // ycc资产提现到收入
    yccWithdrawals(){
      $http.get("plugin.ycc-money.frontend.withdraw.withdraw", {amount:this.info_form.balance_money}, "").then(res => {
        if (res.result !== 1) {
          return this.$toast(res.msg);
        }
        this.$toast(res.msg);
        this.getData();
      });
    },
    // 获取数据
    getData() {
      let json = {};
      let url = 'finance.balance-withdraw.newpage';
      if(this.priceDifferencePool){
        url = 'plugin.price-difference-pool.frontend.modules.pool.controllers.withdraw.page';
      }else if(this.$route.name == 'Ycc_withdrawals'){
        url = "plugin.ycc-money.frontend.index.index";
      }
      $http.get(url, json, "获取中").then(
        (response)=> {
          if (response.result === 1) {
            if(this.priceDifferencePool){
              this.priceDifferencePool_buttons = response.data;
              this.balance = response.data.pool;
              
              return
            }
            if(this.$route.name == "Ycc_withdrawals"){
              this.priceDifferencePool = false;
              this.balanceLang = '';
              this.balance = response.data.plugin_member.amount;
              this.withdraw_income_percent = response.data.withdraw_income_percent;
              return
            }
            this.balance = response.data.balance;
            this.ytx_money = response.data.ytx_money || 0
            this.bank_card_status = response.data.bank_card_status;//是否完善会员中心-银行卡信息
            this.info = response.data; //保存总数据
            this.has_password = response.data.has_password;
            this.need_password = response.data.need_password;
            this.poundage = response.data.poundage;
            this.withdraw_multiple = Number(response.data.withdraw_multiple);
            this.buttons = response.data.button;

          } else {
            Toast(response.msg);
          }
        },
        function(response) {
          Toast(response);
        }
      );
    },

    // 获取银行卡列表
    getwithList() {
      $http.get("plugin.converge_pay.frontend.controllers.converge-pay-bank-card.get-bank-card-list").then(res => {
        if (res.result == 1) {
          res.data.bank_list.map(item => {
            item.check = false;
            if (item.receiverAccountNoEnc != "" && item.receiverAccountNoEnc != null) {
              item.bankName += "(" + item.receiverAccountNoEnc.substring(item.receiverAccountNoEnc.length - 4) + ")";
            }
          });
          this.withList = res.data;
        } else {
          this.$dialog.alert({ message: res.msg });
        }
      });
    },
    checkOut(item) {
      // item.check = !item.check;
      this.withList.map(val => {
        if (val.id == item.id) {
          // val.check = !item.check;
        } else {
          val.check = false;
        }
      });
      //运行机制：先执行该函数，再双向绑定
      if (item.check == false) {
        this.show3 = false;
        this.show2 = true;
        this.checkObj = item;
      }
    },
    backTap() {
      this.show2 = false;
      this.show1 = true;
      this.show3 = false;
    },
    gotoList() {
      this.show2 = false;
      this.show1 = false;
      this.show3 = true;
    },
    getData2() {
      let that = this;
      let json = { member_id: this.$route.params.member_id };
      $http.get("plugin.supplier.frontend.withdraw.index", json, "获取中").then(
        function(response) {
          if (response.result === 1) {
            that.balance = response.data.cost_money;
            that.service_money = response.data.service_money;
            that.service_type = response.data.service_type;

            that.withdrawType = response.data.type;
          } else {
            console.log(response.msg);
            Toast(response.msg);
          }
        },
        function(response) {
          console.log(response);
        }
      );
    },
    btnclass(type) {
      if (type == 1) {
        return "icon-balance_h";
      } else if (type == 2) {
        return "icon-balance_i";
      } else if (type == 3) {
        return "icon-balance_j";
      } else {
        return "icon-balance_g";
      }
    },
    // 提交银行卡的东西
    getTp() {
      console.log(this.checkObj, "选中的参数");

      $http.post("plugin.converge_pay.frontend.controllers.converge-pay-bank-card.set-bank-card", { set: this.checkObj }).then(res => {
        if (res.result == 1) {
          console.log(this.supplier, "判断是什么");
          if (this.supplier == "supplier") {
            this.towithdrawalHj(5);
          } else {
            this.confirmPost({value: this.pay_type});
          }
        } else {
          this.$dialog.alert({ message: res.msg });
        }
      });
    },
    suppierGotiem() {
      this.getTp();
    },
    async towithdrawal(type) {
      if (this.withdraw_multiple > 1 && this.service_type == 0) {
        if (this.info_form.balance_money % this.withdraw_multiple != 0) {
          this.$dialog.alert({ message: `提现金额需要是${this.withdraw_multiple}的整倍数` });
          return;
        }
      }
      if (type == 5) {
        $http.get("plugin.converge_pay.frontend.controllers.converge-pay-bank-card.get-bank-card").then(res => {
          if (res.result == 1) {
            // this.towithdrawalHj(type)
            this.show2 = true;
            this.checkObj = res.data;
            this.checkObj.bankName = res.data.bankName + "(" + res.data.receiverAccountNoEnc.substring(res.data.receiverAccountNoEnc.length - 4) + ")";
            this.getwithList();
            this.getCartWith("suppier");
            return;
          } else {
            if (res.data.status == -1) {
              this.$router.push(this.fun.getUrl("bankCardInformation"));
            }
            this.$dialog.alert({ message: res.msg });

            return;
          }
        });
        return;
      }
      if (type == 8) {
        if(!this.hema_pic){
          this.$refs.hemaPoupShow.show = true;
          return
        }
      }
      this.towithdrawalHj(type);
    },
    // 获取手续费
    getCartWith(type) {
      console.log(type, "类型");

      let url = "";
      let money = "";
      if (type == "suppier") {
        url = "plugin.supplier.frontend.withdraw.converge-withdraw";
      } else {
        url = "finance.balance-withdraw.converge-withdraw";
        money = this.info_form.balance_money;
      }
      $http.get(url, { withdraw_money: money }).then(res => {
        console.log(res, "数据");
        if (res.result == 1) {
          this.poundageHj = res.data.poundage;
          this.actual_amount = res.data.actual_amount;
          this.cost_money = res.data.cost_money;
          if(type == 'eplus'){
            this.show = true;
          }
        } else {
          this.$dialog.alert({ message: res.msg });
        }
      });
    },
    // 智E+ 提现
    onConfirm(e){
      if(!e.radio){
        this.$dialog.alert({ message: '请选择银行卡' })
        return
      }
      let json = {
        withdraw_type: '13',
        withdraw_money: this.info_form.balance_money,
        bank_card_no:e.radio
      };
      $http.get("finance.balance-withdraw.withdraw", json, "正在提交数据").then(
        (response)=> {
          if (response.result == 1) {
            this.$dialog.alert({ message: response.msg }).then(() => {
              this.$router.go(-1);
            });
            this.show = false;
            this.info_form.balance_money = ''
          } else {
            this.$dialog.alert({ message: response.msg })
          }
        },
        function(response) {
          // error callback
        }
      );
    },
    getBankList(){
      $http.get("plugin.eplus-pay.frontend.card.bindCardList", {}," ").then(res => {
        if (res.result == 1) {
          this.list = res.data;
          this.getCartWith('eplus');
        } else {
          this.$dialog.alert({ message: res.msg });
        }
      });
    },
    hemaExtraConfirm(e){
      this.hema_pic = e;
      this.towithdrawalHj(8);
    },
    // 提现方法提共
    towithdrawalHj(type) {
      this.pay_type = type;
      const that = this;
      console.log(this.balance);
      if (this.balance == undefined || this.balance <= 0 || this.balance == 0) {
        this.$dialog.alert({ message: `${initWithdrawal}金额不可低于0元` });
        return;
      }
      let json = {
        apply_type: this.pay_type,
        member_id: that.$route.params.member_id
      }
      if(type == 8){
        json.pic = this.hema_pic;
      }
      $http
        .get(
          "plugin.supplier.frontend.withdraw.withdraw",
          json,
          "正在提交数据"
        )
        .then(
          function(response) {
            if (response.result === 1) {
              that.$dialog.alert({ message: response.msg }).then(() => {
                that.$router.go(-1);
              });
              that.show2 = false;
            } else {
              that.$dialog.alert({ message: response.msg });
            }
          },
          function(response) {
            // error callback
          }
        );
    },

    async confirmPost(item) {
      console.log(item, "提现类型");
      let { value: type, other = {} } = item;
      // withdraw_money
      let that = this;
      if (parseFloat(this.info_form.balance_money) > parseFloat(this.balance)) {
        this.$dialog.alert({ message: `${initWithdrawal}金额不可大于您的${this.balanceLang}` });

        return;
      }

      if (this.info_form.balance_money == undefined || this.info_form.balance_money <= 0 || this.info_form.balance_money == 0) {
        this.$dialog.alert({ message: `${initWithdrawal}金额不可低于0元` });

        return;
      }

      if (this.need_password == true && this.has_password == false) {
        that.$dialog.confirm({ message: "请先设置支付密码" }).then(() => {
          that.$router.push(that.fun.getUrl("set_balance_password", {}));
        });
        return;
      }
      if(type == 13){
        if(other.eplus_withdraw_is_auth == 0){
          this.$dialog.alert({ message: '请先完成认证' }).then(()=>{
            this.$router.push(this.fun.getUrl("wisdomBindTask", {  }));
          });
          return
        }else{
          this.getBankList()
          return
        }
      }
      if(type == 14){
        // 银典支付 判断是否完善 会员中心-银行卡信息
        if(!other.bank_card_status) {
          this.$dialog.alert({ message: "该会员未添加默认银行卡" })
          .then(()=>{
            this.$router.push(this.fun.getUrl("memberBank", { }));
          })
          return
        }
      }
      if(type == 16){
        this.set_verify = other?.jianzhimao_bank?.electronic_sign?.member_set_verify;
        if(!other?.jianzhimao_bank.bank_card_status) {
          this.bank_card_status = true;
        }
        if(!other?.jianzhimao_bank?.electronic_mobile_status?.sign){
          this.$dialog.confirm({ title: `请选择签约模式`, confirmButtonText: '代理签约',cancelButtonText:'自行签约'})
            .then(() => {
              console.log('代理签约,去新页面')
              this.$router.push(this.fun.getUrl("jianzhimaoAgentSign", {}));
            }).catch(() => {
              console.log('自行签约')
              this.jianzhimao_bank_show = true;
            });
          return
        }
      }
      if(type == 17){
        if(other?.tax_withdraw_bank?.electronic_sign?.member_set_verify.length > 0){
          let set_verify = other?.tax_withdraw_bank?.electronic_sign?.member_set_verify;
          for (let i = 0; i < set_verify.length; i++) {
            if(!set_verify[i].status){
              this.$dialog.alert({ message: set_verify[i].tips })
              .then(()=>{
                this.$router.push(this.fun.getUrl("tax_withdraw_bank", { }));
              })
              return
            }
          }
        }
      }
      if(type == 26) {
        if (!other?.integration_pay_share_huifu_withdraw_bank?.has_open_account) {
          this.$dialog.confirm({ title: `请先开户`, confirmButtonText: "去开户", cancelButtonText: "取消" }).then(() => {
            this.$router.push(this.fun.getUrl("userAccount", {}));
          });
          return false;
        }
        if (!other?.integration_pay_share_huifu_withdraw_bank?.has_settle_info) {
          this.$dialog.confirm({ title: `请先是否设置银行卡信息`, confirmButtonText: "设置", cancelButtonText: "取消" }).then(() => {
            this.$router.push(this.fun.getUrl("windAccount", {}));
          });
          return false;
        }
      }
      if(type == 18 || type == 19 || type == 20){
        // 汇聚代发薪的验证
        let key = '';
        if(type == 18 ){
          key = 'consol_withdraw_bank'
        }else if(type == 19){
          key = 'consol_withdraw_alipay'
        }else if(type == 20){
          key = 'consol_withdraw_wechat'
        }
        let check = await this.hJwithdraw_extra(key,other);
        if(!check) return
      }
      if(type == 21 || type == 22 || type == 23){
        // 云汇算代发薪
        let key = '';
        if(type == 21 ){
          key = 'huiis_bank'
        }else if(type == 23){
          key = 'huiis_ali'
        }else if(type == 22){
          key = 'huiis_wx'
        }
        let check = await this.huiis_extra(key, other);
        if(!check) return;
      }
      if(type == 24 || type == 25){
        let check = await this.gong_mall_extra(type, other);
        if(!check) return
      }
      if(this.isLocks) return;
      this.isLocks = true;

      let json = {
        withdraw_type: type,
        withdraw_money: this.info_form.balance_money
      };

      if (this.need_password == true) {
        //开启支付密码验证
        this.isLocks = false;
        let pass = await this.getPayKeyboardPassword();
        json.password = pass;
      }
      $http.get("finance.balance-withdraw.withdraw", json, "正在提交数据").then(
        (response)=> {
          this.isLocks = false;
          if (response.result == 1) {
            that.$dialog.alert({ message: response.msg }).then(() => {
              that.$router.go(-1);
            });
            that.show2 = false;
          } else {
            if(response.data.redirect_url){
              Dialog.alert({
                  message: response.msg,
              })
                .then(() => {
                  window.location.href = response.data.redirect_url;
                })
                .catch(() => {
                  // on cancel
                });
            }else{
              that.$dialog.alert({ message: response.msg });
            }
            let high_light = ["7", "8", "9"]; //提现高灯
            if (high_light.indexOf(type) > -1 && response.data.high_light && response.data.high_light == 1) {
              //填写高灯信息
              let _pay_type = "";
              switch (type) {
              case "7":
                _pay_type = "high_light_wechat";
                break;
              case "8":
                _pay_type = "high_light_alipay";
                break;
              case "9":
                _pay_type = "high_light_bank";
                break;
              default:
                break;
              }
              that.$router.push(that.fun.getUrl("HighLight", { value: _pay_type }));
            }
          }
        },
        function(response) {
          // error callback
        }
      );
    },
    gong_mall_extra(type, other){
      let extra_data = other.gong_mall_withdraw;
      if (!extra_data?.has_member_info || (type == 25 && !extra_data.has_bank_card) || (type == 24 && !extra_data.has_ali_info)) {
        this.$dialog.confirm({ title: `请先完善资料【含姓名，手机号，身份证信息，${type == 25?'银行卡信息':'支付宝信息'}】?`, confirmButtonText: "确认", cancelButtonText: "取消" }).then(() => {
          this.$router.push(this.fun.getUrl("info", {}));
        });
        return false;
      }
      if (!extra_data?.has_sign) {
        this.$dialog.confirm({ title: `前往签约?`, confirmButtonText: "去签约", cancelButtonText: "取消" }).then(() => {
          window.location.href = extra_data.sign_url;
        });
        return false;
      }
      return true
    },
    huiis_extra(key,other){
      this.popupType = key;
      let _data = other.cloud_pay_money;
      this.bank_card_status = !_data.bank_card_status;
      if(key == 'huiis_ali' && !_data.has_alipay){
        this.$dialog.confirm({ message: `您未配置支付宝信息，请先修改个人信息中支付宝信息`})
          .then(() => {
            this.$router.push(this.fun.getUrl("info", {}));
          }).catch(() => {});
          return false
      }
      if(!_data.member_info){
        console.log('用户资料没有完善')
        this.jianzhimao_bank_show = true;
        this.set_verify = _data.member_set_verify;
        return false
      }
      if(!_data.has_signing){
        // 没有签约
        this.$router.push(this.fun.getUrl("cloud_pay_money_sign", {}));
        return false
      }
      return true
    },
    hJwithdraw_extra(key,other){
      let _data = other[key];
      //汇聚代发薪的验证
      if(_data && !_data?.bank_card_status && key == "consol_withdraw_bank"){
        this.$dialog.alert({ message: "请先填写银行卡信息" })
          .then(()=>{
            this.$router.push(this.fun.getUrl("hJwithdrawType", {}));
          })
        return false
      }
      if(_data && _data?.electronic_sign?.member_set_verify.length > 0){
        let set_verify = _data?.electronic_sign?.member_set_verify;
        for (let i = 0; i < set_verify.length; i++) {
          if(!set_verify[i].status){
            this.$dialog.alert({ message: set_verify[i].tips })
            .then(()=>{
              if(set_verify[i].name != 'openid') this.$router.push(this.fun.getUrl("hJwithdrawType", {}));
            })
            return false
          }
        }
      }
      return true
    },
    all(){
      this.info_form.balance_money = this.balance;
    },
    support_center(){
      $http.post("plugin.support-center.frontend.withdraw.get-write-off-code", {
        withdraw_money:this.info_form.balance_money,
        withdraw_type:'15'
      }, "").then(
        response => {
          this.isLocks = false;
          if (response.result === 1) {
            this.support_code_url = response.data.url;
            this.support_code = true;
          } else {
            this.$dialog.alert({ message: response.msg });
          }
        },
        function(response) {
          this.$dialog.alert({ message: response.msg });
        }
      );
    },
    payComplete(text) {
      console.log(text, "页面");
      payKeyboardAsync.complete(text);
    },
    getPayKeyboardPassword() {
      this.show2 = false;
      this.show3 = false;
      this.payKeyboardShow = true;
      return new Promise((resove, reject) => {
        payKeyboardAsync.addCompleteFn(pass => {
          resove(pass);
        });
      });
    },
    async priceDifferencePool_confirm(type){
      if (parseFloat(this.info_form.balance_money) > parseFloat(this.priceDifferencePool_buttons.pool)) {
        this.$dialog.alert({ message: `${initWithdrawal}金额不可大于您的${this.balanceLang}` });
        return;
      }
      let json = {
        pay_id:type,amount:this.info_form.balance_money
      }
      if (this.need_password == true) {
        //开启支付密码验证
        let pass = await this.getPayKeyboardPassword();
        json.password = pass;
      }
      $http.post("plugin.price-difference-pool.frontend.modules.pool.controllers.withdraw.apply", json, "").then(
        response => {
          if (response.result === 1) {
            this.$dialog.alert({ message: response.msg }).then(()=>{
              this.getData();
              this.info_form.balance_money = 0;
            })
          } else {
            this.$dialog.alert({ message: response.msg });
          }
        },
        function(response) {
          this.$dialog.alert({ message: response.msg });
        }
      );
    },
    confirm(item) {
      let { value: type, other = {} } = item;
      if(this.priceDifferencePool){
        // price-difference-pool 插件的提现
        this.priceDifferencePool_confirm(type);
        return;
      }
      if((type==12 ||type==11) && other.worker_withdraw.bank_is_register == 0 || type==10 && other.worker_withdraw.wechat_is_register == 0){
        this.$router.push(this.fun.getUrl('WorkerWithdrawType',{path:'balance_withdrawals'}));
        return;
      }
      if (this.withdraw_multiple > 1 && this.service_type == 0) {
        if (this.info_form.balance_money % this.withdraw_multiple != 0) {
          this.$dialog.alert({ message: `提现金额需要是${this.withdraw_multiple}的整倍数` });
          return;
        }
      }
      this.pay_type = Number(type);
      switch (this.pay_type) {
      case 3:
        this.manualVerify(this.pay_type);
        break;
      case 4:
        this.checkEup(this.pay_type);
        break;
      case 6:
        if (this.info_form.balance_money == "") {
          this.$dialog.alert({ message: "请输入提现金额" });
        } else {
          this.checkHJ(this.pay_type);
        }
        break;
      case 15:
        this.support_center();
        break
      default:
        this.confirmPost({value:this.pay_type, other:other});
        break;
      }
    },

    // 手动提现验证
    manualVerify(type) {
      var that = this;

      if (parseFloat(this.info_form.balance_money) > parseFloat(this.balance)) {
        this.$dialog.alert({ message: `${initWithdrawal}金额不可大于您的${this.balanceLang}` });

        return;
      }

      if (this.info_form.balance_money == undefined || this.info_form.balance_money <= 0 || this.info_form.balance_money == 0) {
        this.$dialog.alert({ message: `${initWithdrawal}金额不可低于0元` });

        return;
      }

      if(this.isLocks) return;
      this.isLocks = true;

      $http.post("finance.balance-withdraw.is-can-submit", {}, "").then(
        response => {
          this.isLocks = false;
          if (response.result === 1) {
            if (response.data.status) {
              that.confirmPost({value:type}); // 提现
            } else {
              that.setManualInfo(type, response.data.manual_type);
            }
          } else {
            that.$dialog.alert({ message: response.msg });
          }
        },
        function(response) {
          that.$dialog.alert({ message: response.msg });
        }
      );
    },

    setManualInfo(type, manual_type) {
      let msg = "";
      let routerPath = "";

      switch (manual_type) {
      case "bank":
        msg = "请先填写银行卡信息";
        routerPath = "memberBank";
        break;
      case "wechat":
        msg = "请先填写微信信息";
        routerPath = "info";
        break;
      case "alipay":
        msg = "请先填写支付宝信息";
        routerPath = "info";
        break;
      default:
        break;
      }

      let that = this;

      this.$dialog
        .confirm({
          title: "提示",
          message: msg
        })
        .then(() => {
          // on confirm
          that.$router.push(that.fun.getUrl(routerPath, {}));
        })
        .catch(() => {
          // on cancel
        });
    },

    checkEup(type) {
      var that = this;
      if(this.isLocks) return;
      this.isLocks = true;
      $http.post("plugin.eup-pay.api.account.pi-account", {}, "").then(
        (response)=> {
          this.isLocks = false;
          if (response.result == 1) {
            if (response.data.bool == 1) {
              that.confirmPost({value:type}); // 提现
            }
          } else if (response.result == 0) {
            if (response.data.bool == 0) {
              let msg = response.msg;
              that.$dialog
                .confirm({
                  title: "提示",
                  message: msg
                })
                .then(() => {
                  // on confirm
                  that.$router.push(that.fun.getUrl("info", {}));
                })
                .catch(() => {
                  // on cancel
                });
            }
          }
        },
        function(response) {
          that.$dialog.alert({ message: response.msg });
        }
      );
    },

    withGotiem() {
      this.getTp();
    },
    // 第三方汇聚提现
    checkHJ(type) {
      if(this.isLocks) return;
      this.isLocks = true;
      $http.get("plugin.converge_pay.frontend.controllers.converge-pay-bank-card.get-bank-card").then(res => {
        this.isLocks = false;
        if (res.result == 1) {
          this.show2 = true;
          this.checkObj = res.data;
          this.checkObj.bankName = res.data.bankName + "(" + res.data.receiverAccountNoEnc.substring(res.data.receiverAccountNoEnc.length - 4) + ")";
          this.getwithList();
          this.getCartWith();
        } else {
          if (res.data.status == -1) {
            this.$router.push(this.fun.getUrl("bankCardInformation"));
          }
          this.$dialog.alert({ message: res.msg });
        }
      });
    }
  },
  components: { payKeyboard, diyBackGround,eplusWithdraw,jianzhimaoPopup,hemaPoup }
};
